package com.yiqi.news.app.utils;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.app.AlertDialog;

import com.yiqi.news.R;


/**
 * Created by ezy on 15/11/10.
 */
public class DialogUtil {

    public static AlertDialog alert(Context context, String title, DialogInterface.OnClickListener onOk) {
        return new AlertDialog.Builder(context).setMessage(title).setNegativeButton("取消", null).setPositiveButton("确定", onOk).show();
    }


    public static AlertDialog alertIntegral(Context context, String title, DialogInterface.OnClickListener onOff, DialogInterface.OnClickListener onOk) {
        return new AlertDialog.Builder(context).setMessage(title).setNegativeButton("取消", onOff).setPositiveButton("立即兑换", onOk).show();
    }

    public static AlertDialog alertIntegralOk(Context context, String title, DialogInterface.OnClickListener onOk) {
        return new AlertDialog.Builder(context).setMessage(title).setPositiveButton("确定", onOk).show();
    }


    public static ProgressDialog showLoading(Context context) {

        ProgressDialog loading = ProgressDialog.show(context, "", "", true, true);
        loading.getWindow().setBackgroundDrawable( new ColorDrawable(Color.TRANSPARENT ) );
        loading.setContentView(R.layout.widget_progressbar);
        return loading;
    }


}
